package cn.wolfcode.luowowo.article.query;

import cn.wolfcode.luowowo.article.domain.Travel;
import cn.wolfcode.luowowo.common.query.QueryObject;
import lombok.Getter;
import lombok.Setter;

@Setter
@Getter
public class TravelQuery extends QueryObject{

    private Long destId = -1L;
    //天数
    private int dayType = -1;
    //月份
    private int travelTimeType = -1;
    //人均消费
    private int perExpendType = -1;
    //排序
    private int orderType = -1;

    private Boolean isPublic = true;

    private int state = Travel.STATE_RELEASE;

    public String getOrderBy() {
        return orderType == 2 ? "t.viewnum desc" : "t.createTime desc";
    }

    //映射天数
    public TravelCondition getDay() {
        return TravelCondition.TRAVEL_DAY.get(dayType);
    }

    //映射月份
    public TravelCondition getTime() {
        return TravelCondition.TRAVEL_TIME.get(travelTimeType);
    }

    //映射人均消费
    public TravelCondition getExpend() {
        return TravelCondition.TRAVEL_PRE_EXPENDS.get(perExpendType);
    }
}
